package com.longxi.tianjintianbao.ui.fragment.maintain;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.activity.maintain.MaintainListActivity;
import com.longxi.tianjintianbao.ui.base.LazyFragment;
import com.longxi.tianjintianbao.ui.presenter.maintain.MaintainListFgPresenter;
import com.longxi.tianjintianbao.ui.view.maintain.IMaintainListFgView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;

public class MaintainListFragment extends LazyFragment<IMaintainListFgView, MaintainListFgPresenter> implements IMaintainListFgView {

    private String state = "-1";

    @Override
    protected int provideContentViewId() {
        return R.layout.include_general_list;
    }

    @Override
    protected void init(View view) {
        state = getArguments().getString("state");
        //初始化View
        initView();
        mPresenter.initAdapter(state);
        //初始化数据
        initData();
    }

    public void initView(){

    }

    @Override
    protected MaintainListFgPresenter createPresenter() {
        return new MaintainListFgPresenter((MaintainListActivity) getActivity(), this);
    }

    private void initData() {
        mPresenter.getEquipmentMaintainList(state);
//        mPresenter.setDate();
    }

    public MaintainListFragment setArguments(String state) {
        Bundle bundle = new Bundle();
        bundle.putString("state", state);
        setArguments(bundle);
        return this;
    }

    @Override
    public SmartRefreshLayout getRefreshLayout() {
        return mRefreshLayout;
    }

    @Override
    public RecyclerView getRvContent() {
        return mRvContent;
    }

    public void refreshReceiptList() {
    }

    @Override
    public void onDestroy() {
        mPresenter.onDestroy();
        super.onDestroy();
    }
}
